<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>切换图片淡入效果</title>
<style>
body,ul,ol{margin:0;padding:0;}
li{ list-style:none;}
img{ border:none; vertical-align:top; }
#box{width:470px;height:150px; position:relative; margin:30px auto; overflow:hidden;}
ul{ width:470px; position:absolute;left:0; top:0; z-index:1;}
ul li{width:470px; display:none; filter:alpha(opacity=0); opacity:0;}
ol{z-index:2; width:120px; position:absolute;right:10px; bottom:10px;}
ol li{ width:20px;height:20px; float:left;margin:0 2px; display:inline; background:#fff; color:#f60; line-height:20px; text-align:center;}
ol .active{ background:#f60; color:#fff;}
</style>
<script src="__PUBLIC__/js/jquery-1.11.3.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/move.js"></script>
<script>

//主要是定时器效果，js版本考虑opacity浏览器兼容性,jquery考虑了兼容性问题，opacity判断0-1

//透明度在IE浏览器和其他相关浏览器中的设置方法不太相同，IE使用filter：alpha属性，firefox使用opactiy属性，下面示例设置透明度为30%：
//IE：filter: alpha(opacity:30)； 
//firefox：opacity(0.3)；

/*js dom版本
window.onload = function(){
	var oOl = document.getElementsByTagName('ol')[0];
	var aLiOl = oOl.getElementsByTagName('li');
	
	var oUl = document.getElementsByTagName('ul')[0];
	var aLiUl = oUl.getElementsByTagName('li');
	
	for(var i=0;i<aLiOl.length;i++){
		aLiOl[i].index = i;
		aLiOl[i].onmouseover = function(){
			for(var i=0;i<aLiOl.length;i++){
				aLiOl[i].className = '';
				aLiUl[i].style.display = 'none';
				aLiUl[i].style.filter = 'alpha(opacity=0)';
				aLiUl[i].style.opacity = 0;
			}
			this.className = 'active';
			aLiUl[this.index].style.display = 'block';
			startMove( aLiUl[this.index] , {opacity:100} );
		};
	}
};
*/

$(document).ready(function(){
	$("#box").find("ol").find("li").mouseover(function(){	
		//先ol class为空，ul都不显示， 当前显示
		$("#box").find("ol").find("li").attr("class","");
		$("#box").find("ul").find("li").css("display","none");
		$("#box").find("ul").find("li").css("opacity","0");
		
		var index = $("#box").find("ol").find("li").index($(this));
		$(this).attr("class","active");
		$("#box").find("ul").find("li:eq("+ index +")").css("display","block");
		startMove($("#box").find("ul").find("li:eq("+ index +")")[0], {opacity:100} );
	});
});


</script>
</head>
<body>
<div id="box">
	<ul>
    	<li style="display:block; filter:alpha(opacity=100); opacity:1;"><img src="__PUBLIC__/images/1.jpg" alt=""/></li>
        <li><img src="__PUBLIC__/images/2.jpg" alt=""/></li>
        <li><img src="__PUBLIC__/images/3.jpg" alt=""/></li>
        <li><img src="__PUBLIC__/images/4.jpg" alt=""/></li>
        <li><img src="__PUBLIC__/images/5.jpg" alt=""/></li>
    </ul>
    <ol>
    	<li class="active">1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
        <li>5</li>
    </ol>
</div>
</body>
</html>
